package org.toycode.logindemo.entity;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
//import org.toycode.solr.entity.AbstractEntity;

/**
 * This class depicts a system user. 
 *
 * @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
 * @version 1.0.0.1, Aug 27, 2009
 */
@Entity
@NamedQueries(@NamedQuery(name = "findUserByName",
                          query = "SELECT systemUser FROM SystemUser systemUser " +
                                  "WHERE systemUser.name=:userName"))
public class SystemUser /*extends AbstractEntity*/ implements Serializable {

    /**
     * generated default serial version id.
     */
    private static final long serialVersionUID = 1L;
    /**
     * id of this user. 
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    /**
     * name of this user.
     */
    private String name;
    /**
     * password of this user.
     */
    private String password;
    /**
     * ms word file path. 
     */
    private String msWordPath;

    /**
     * Gets the ms word file path. 
     * 
     * @return the path of the word file
     */
    public String getMsWordPath() {
        return msWordPath;
    }

    /**
     * Sets the ms word file path.
     *
     * @param msWordPath new path of the word file
     */
    public void setMsWordPath(final String msWordPath) {
        this.msWordPath = msWordPath;
    }

    /**
     * Gets the name of this user.
     * @return the name of this user
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the name of this user.
     * @param name new name of this user
     */
    public void setName(final String name) {
        this.name = name;
    }

    /**
     * Gets the password of this user.
     * @return the password of this user
     */
    public String getPassword() {
        return password;
    }

    /**
     * Sets the password of this user.
     * @param password new password of this user
     */
    public void setPassword(final String password) {
        this.password = password;
    }

    /**
     * Gets the id of this user.
     * @return the id of this user
     */
    public Long getId() {
        return id;
    }

    /**
     * Sets the id of this user.
     * @param id new id of this user
     */
    public void setId(final Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean equals(final Object obj) {
        if (!(obj instanceof SystemUser)) {
            return false;
        }
        SystemUser other = (SystemUser) obj;
        if ((this.id == null && other.id != null) || (this.id != null &&
                                                      !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        return SystemUser.class + "[id=" + id + "]";
    }
}
